Skip to content

Conversation

@jjaeroong
Copy link
Collaborator

@jjaeroong jjaeroong commented Aug 8, 2025

PR 타입(하나 이상의 PR 타입을 선택해주세요)

  • 기능 추가
  • 기능 삭제
  • 버그 수정
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트
  • 리팩터링

반영 브랜치

ex) feat/login -> dev

작업 내용

ex) 로그인 시, 구글 소셜 로그인 기능을 추가했습니다.

테스트 결과

ex) 베이스 브랜치에 포함되기 위한 코드는 모두 정상적으로 동작해야 합니다. 결과물에 대한 스크린샷, GIF, 혹은 라이브

Summary by CodeRabbit

  • 신규 기능

    • 사용자 및 본인의 피드 목록을 조회하는 새로운 엔드포인트가 추가되었습니다. (커서 기반 페이지네이션 지원)
  • 버그 수정

    • 피드, 마이페이지 관련 기존 엔드포인트가 변경되어, 일부 불필요한 정보(닉네임, 역할, 온도 등)가 더 이상 제공되지 않습니다.
  • 스타일

    • 사용자 닉네임 뒤에 붙는 접미사가 "씨앗"에서 "새싹"으로 변경되었습니다.
  • 리팩터링

    • 마이페이지 응답 구조가 간소화되어, 피드와 시리즈 코멘트만 포함하도록 변경되었습니다.
    • 피드 저장/좋아요/조회 관련 로직이 배치 방식으로 최적화되었습니다.
  • 문서화

    • Swagger 문서에 새로운 파라미터 설명이 추가되었습니다.

leesumin0526 and others added 8 commits August 7, 2025 16:45
* [FEAT/#365]
- 여기서 저는요 모달 API 생성

* [FEAT/#365]
- isMember 추가, potSummary 보내는 API 개발

* [FEAT/#365]
- 마이페이지 API 수정

* [DEL/#365]
- 필요없는 import문 제거

* [FEAT/#365]
- 팟 진행 기간 수정

* [FEAT/#365]
- pot 예상 기간 수정
* [FEAT/#399]
- 모든팟 조회 role 중복 필터링 기능 추가

* [FEAT/#399]
- 닉네임 프롬프트 수정
- 가입시 kakaoId 입력 받는 거 삭제
[Refactor/#382][jjaeroong]: 씨앗에서 새싹으로 명칭 변경
@coderabbitai
Copy link

coderabbitai bot commented Aug 8, 2025

Walkthrough

이번 변경에서는 사용자 피드 조회 및 마이페이지 관련 API의 구조와 반환 DTO가 대폭 개편되었습니다. FeedController의 피드 조회 엔드포인트가 제거되고, UserController에서 새롭게 커서 기반 피드 조회 엔드포인트가 추가되었습니다. 관련 서비스, 컨버터, DTO, Enum 등도 이에 맞게 수정되었습니다. 또한 "씨앗"이 "새싹"으로 일괄 변경되었습니다.

Changes

Cohort / File(s) Change Summary
FeedController 엔드포인트 제거
src/main/java/stackpot/stackpot/feed/controller/FeedController.java
사용자 피드 조회(GET /feeds/{userId}, /feeds/my-feeds) 엔드포인트 2개 삭제. 관련 메서드, 어노테이션, 파라미터, 반환 DTO 제거.
FeedQueryService 및 구현체 반환타입 변경
src/main/java/stackpot/stackpot/feed/service/FeedQueryService.java,
src/main/java/stackpot/stackpot/feed/service/FeedQueryServiceImpl.java
피드 조회 관련 메서드 반환타입을 FeedPreviewList에서 UserMyPageResponseDto로 변경. 시리즈 댓글 및 피드 리스트 반환. 구현체에서 시리즈 댓글 추가 및 nextCursor 필드 제거.
피드/포트 컨버터 닉네임 접미사 변경
src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java,
src/main/java/stackpot/stackpot/pot/converter/PotApplicationConverter.java,
src/main/java/stackpot/stackpot/pot/converter/PotConverter.java,
src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java
닉네임 뒤에 붙는 "씨앗"을 "새싹"으로 일괄 변경.
FeedSaveRepository 저장수 집계 메서드 추가
src/main/java/stackpot/stackpot/save/repository/FeedSaveRepository.java
feedId 리스트별 저장수 집계 쿼리 및 Map 변환 default 메서드 추가.
SearchServiceImpl 배치 조회 및 Set 활용 개선
src/main/java/stackpot/stackpot/search/service/SearchServiceImpl.java
피드/포트 저장수 및 상태를 배치로 조회, Set 변환 최적화, 인증자 여부 처리 간소화.
UserController 마이페이지 API 개편
src/main/java/stackpot/stackpot/user/controller/UserController.java
기존 mypages API 제거, 커서 기반 피드/시리즈 댓글 조회 API 2종 추가(GET /users/{userId}/feeds, /users/feeds). FeedQueryService 사용, Swagger 문서화 추가.
UserMypageConverter 및 DTO 구조 단순화
src/main/java/stackpot/stackpot/user/converter/UserMypageConverter.java,
src/main/java/stackpot/stackpot/user/dto/response/UserMyPageResponseDto.java
Pot 관련 로직, 필드, 파라미터, 반환값 제거. 시리즈 댓글 및 피드만 포함하도록 단순화.
UserCommandService 및 구현체 파라미터 축소
src/main/java/stackpot/stackpot/user/service/UserCommandService.java,
src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java
getMypages, getUserMypage 메서드에서 dataType 파라미터 제거. Pot 관련 분기 및 로직 삭제, 피드만 반환.
Role Enum 값 변경
src/main/java/stackpot/stackpot/user/entity/enums/Role.java
DEFAULT Enum 값의 한글명을 "씨앗"에서 "새싹"으로 변경.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UserController
    participant FeedQueryService
    participant UserMypageConverter
    participant Repository

    Client->>UserController: GET /users/{userId}/feeds (cursor, size)
    UserController->>FeedQueryService: getFeedsByUserId(userId, cursor, size)
    FeedQueryService->>Repository: fetch feeds, fetch user series
    FeedQueryService->>UserMypageConverter: toDto(user, feeds)
    UserMypageConverter-->>FeedQueryService: UserMyPageResponseDto
    FeedQueryService-->>UserController: UserMyPageResponseDto
    UserController-->>Client: ApiResponse<UserMyPageResponseDto>
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • [Merge]: dev -> main #374: FeedController의 getFeedsByUserId, getFeeds 메서드 내부 서비스 호출만 변경한 PR로, 본 PR에서 해당 메서드가 완전히 제거되어 직접적인 코드 연관성이 높음.
  • [Fix]: 사용자 피드 검색 메소드 명 수정 #373: FeedController의 동일 메서드 내부 서비스 호출만 변경한 PR로, 본 PR과 동일 메서드의 제거 및 반환타입 변경 등에서 직접적으로 연관됨.
  • [Merge]: dev병합 #371: FeedController 및 FeedQueryService의 사용자 피드 조회 로직, 반환타입 등을 변경하는 PR로, 본 PR과 서비스 계층 및 컨트롤러의 구조적 변화에서 강한 코드 레벨 연결이 있음.

Suggested labels

:art: refactor

Poem

새싹이 된 씨앗, 이름 바꿔 반짝
피드와 마이페이지, 구조도 확 바꿔
오래된 API는 안녕,
커서 타고 피드만 쏙!
토끼는 깡총, 코드도 깔끔
새싹처럼 푸르게,
리뷰도 싱그럽게! 🌱🐇

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jjaeroong jjaeroong merged commit 8e64fbb into main Aug 8, 2025
1 of 2 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🔭 Outside diff range comments (3)
src/main/java/stackpot/stackpot/feed/service/FeedQueryServiceImpl.java (2)

209-218: saveCount N+1 쿼리 가능성 → 배치 조회로 최적화

현재 각 피드마다 countByFeed(…)를 호출해 저장 수를 세고 있어 N+1 쿼리가 발생할 수 있습니다. 아래와 같이 한 번에 집계 후 map으로 활용하는 방식을 추천합니다(이미 getLikedFeedsWithPaging에서 유사 패턴 사용 중).

예시:

List<Long> feedIds = feeds.stream().map(Feed::getFeedId).toList();
Map<Long, Integer> saveCountMap = feedSaveRepository.countSavesByFeedIds(feedIds).stream()
        .collect(Collectors.toMap(
            row -> (Long) row[0],
            row -> ((Long) row[1]).intValue()
        ));

List<FeedResponseDto.FeedDto> feedDtos = feeds.stream()
    .map(feed -> {
        int saveCount = saveCountMap.getOrDefault(feed.getFeedId(), 0);
        // ...
    }).toList();

Also applies to: 247-256


183-233: 커서 기반 페이징 보완 필요: UserMyPageResponseDto에 nextCursor 미포함

getFeedsByUserId/getFeeds 메서드는 cursor 파라미터를 받아 다음 페이지 커서를 계산하지만, 반환 DTO인 UserMyPageResponseDtonextCursor 필드가 없어 프론트에서 무한 스크롤 대비가 불완전합니다. 다른 페이징 응답(CursorPageResponse, FeedPreviewList 등)에서는 nextCursor를 포함하고 있으니 일관성 있게 추가해주세요.

점검 위치

  • src/main/java/stackpot/stackpot/feed/service/FeedQueryServiceImpl.java
    • getFeedsByUserId(Long userId, Long nextCursor, int pageSize)
    • getFeeds(Long nextCursor, int pageSize)
  • src/main/java/stackpot/stackpot/user/controller/UserController.java
    • getFeedsByUserId (Line 414–426)
    • getFeeds (Line 437–443)

개선 제안

  1. UserMyPageResponseDto에 Long nextCursor 필드 추가
  2. 서비스 레이어에서 feeds 조회 후 다음 커서 계산
    Long nextCursorVal = (feedList.size() >= pageSize)
            ? feedList.get(feedList.size() - 1).getFeedId()
            : null;
  3. DTO 빌더에 반영
    @Builder
    public class UserMyPageResponseDto {
        private Long id;
        private List<String> seriesComments;
        private List<FeedResponseDto.FeedDto> feeds;
        private Long nextCursor; // 추가
    }

위 변경을 통해 프런트에서 안정적인 커서 페이징을 보장할 수 있습니다.

src/main/java/stackpot/stackpot/user/converter/UserMypageConverter.java (1)

51-57: N+1 쿼리 및 contains 성능 이슈

  1. feedSaveRepository.countByFeed(feed) 호출이 피드 수만큼 반복되어 N+1 쿼리가 발생합니다.
    SearchServiceImpl에서 이미 존재하는 countByFeedIds(...) 배치 메서드를 활용해 주세요.
  2. likedFeedIds / savedFeedIdsList이므로 contains가 O(n)입니다. Set으로 변환하면 O(1)로 개선됩니다.

예시 diff:

-List<Long> likedFeedIds = feedLikeRepository.findFeedIdsByUserId(user.getId());
-List<Long> savedFeedIds = feedSaveRepository.findFeedIdsByUserId(user.getId());
+Set<Long> likedFeedIds = new HashSet<>(feedLikeRepository.findFeedIdsByUserId(user.getId()));
+Set<Long> savedFeedIds = new HashSet<>(feedSaveRepository.findFeedIdsByUserId(user.getId()));

- int saveCount = feedSaveRepository.countByFeed(feed);
+ int saveCount = feedSaveCountMap.getOrDefault(feed.getFeedId(), 0);
🧹 Nitpick comments (14)
src/main/java/stackpot/stackpot/save/repository/FeedSaveRepository.java (2)

13-13: 와일드카드 임포트 지양 권장

java.util.* 대신 필요한 타입만 임포트하면 가독성과 정적 분석 신뢰도가 올라갑니다.


40-47: 카운트 캐스팅 안정성 보강 제안

Hibernate/JPA의 COUNT 결과는 Long이 일반적이지만, 구현체/설정에 따라 Number로 반환될 수 있습니다. 안전하게 캐스팅하면 ClassCastException 가능성을 낮출 수 있습니다.

다음 변경을 권장합니다:

-        for (Object[] row : countByFeedIdsRaw(feedIds)) {
-            map.put((Long) row[0], (Long) row[1]);
-        }
+        for (Object[] row : countByFeedIdsRaw(feedIds)) {
+            Long feedId = (Long) row[0];
+            Long cnt = ((Number) row[1]).longValue();
+            map.put(feedId, cnt);
+        }

또는 DTO 프로젝션을 사용하면 캐스팅 자체를 없앨 수 있습니다.

src/main/java/stackpot/stackpot/pot/converter/PotApplicationConverter.java (1)

48-49: 닉네임 접미사 하드코딩 제거 및 공통화 제안

" 새싹" 접미사가 여러 컨버터에 하드코딩되어 있어 변경 시 누락 위험이 큽니다. 상수/유틸로 공통화하세요.

예시:

  • 공통 상수 정의
// 예: stackpot.stackpot.common.display.UserDisplayConstants
public final class UserDisplayConstants {
    private UserDisplayConstants() {}
    public static final String NICKNAME_SUFFIX = " 새싹";
}
  • 본 파일 적용
-                .userNickname(entity.getUser().getNickname() + " 새싹")
+                .userNickname(entity.getUser().getNickname() + UserDisplayConstants.NICKNAME_SUFFIX)
src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (2)

43-44: 닉네임 접미사 공통화 권장

여기서도 " 새싹"이 하드코딩되어 있습니다. 공통 상수/유틸을 도입해 일관되게 사용해 주세요.

-                .userNickname(user.getNickname() + " 새싹")
+                .userNickname(user.getNickname() + UserDisplayConstants.NICKNAME_SUFFIX)

49-59: 중복 필드 설정 제거

.potRecruitmentDeadline(...)가 두 번 설정됩니다(라인 49, 58). 의미적 문제는 없지만 유지보수성 저하 요소이므로 하나를 제거하세요.

가능한 수정:

                 .potEndDate(pot.getPotEndDate())
-                .potRecruitmentDeadline(pot.getPotRecruitmentDeadline())
                 .potLan(pot.getPotLan())
                 .potStatus(pot.getPotStatus())
                 .applied(isApplied)
@@
                 .isSaved(isSaved)
-                .potRecruitmentDeadline(pot.getPotRecruitmentDeadline())
+                .potRecruitmentDeadline(pot.getPotRecruitmentDeadline())

(중복되는 둘 중 하나를 삭제)

src/main/java/stackpot/stackpot/pot/converter/PotConverter.java (2)

75-76: 닉네임 접미사 공통화 권장

다른 컨버터와 동일하게 " 새싹" 하드코딩을 공통 상수/유틸로 치환해 변경 용이성을 높여 주세요.

-                .userNickname(user.getNickname() + " 새싹")
+                .userNickname(user.getNickname() + UserDisplayConstants.NICKNAME_SUFFIX)

65-85: 메서드명 오타(toPrviewDto) — 호환성 고려한 리네이밍 제안

toPrviewDtotoPreviewDto로 정정 권장. 외부 호출점을 고려해 기존 메서드는 @deprecated로 남기고 내부 위임 방식으로 천이하면 안전합니다.

예시:

@Deprecated
public PotPreviewResponseDto toPrviewDto(User user, Pot pot, List<String> recruitmentRoles, boolean isSaved, int potSaveCount, boolean isMember) {
    return toPreviewDto(user, pot, recruitmentRoles, isSaved, potSaveCount, isMember);
}

public PotPreviewResponseDto toPreviewDto(User user, Pot pot, List<String> recruitmentRoles, boolean isSaved, int potSaveCount, boolean isMember) {
    // 기존 구현 내용
}

또한 본 클래스의 toSearchDto는 역할 표시를 RoleNameMapper로 처리하는 반면, 본 메서드는 " 새싹" 접미사를 사용하고 있어 사용자 표시 규칙이 일관되지 않습니다. 표시 규칙을 통합하는 Helper(예: UserDisplayFormatter) 도입을 검토해 주세요.

src/main/java/stackpot/stackpot/feed/service/FeedQueryServiceImpl.java (2)

182-182: 읽기 전용 트랜잭션으로 지정 권장

조회 전용 메서드이므로 readOnly 플래그를 명시해 불필요한 flush/쓰기 지연 등을 방지하는 것이 좋습니다.

-    @Transactional
+    @Transactional(readOnly = true)

220-227: series 리스트 null‑세이프 처리 권장

일부 사용자에서 seriesList가 null일 가능성이 있다면 NPE를 유발할 수 있습니다. 방어적 코드를 권장합니다.

예시:

List<String> seriesComments = Optional.ofNullable(targetUser.getSeriesList())
        .orElseGet(Collections::emptyList)
        .stream()
        .map(Series::getComment)
        .toList();
List<String> seriesComments = Optional.ofNullable(user.getSeriesList())
        .orElseGet(Collections::emptyList)
        .stream()
        .map(Series::getComment)
        .toList();

Also applies to: 258-261

src/main/java/stackpot/stackpot/user/converter/UserMypageConverter.java (1)

40-44: seriesComments null-safety 확인 필요

user.getSeriesList()null일 경우 NullPointerException이 발생합니다.
엔티티 초기화가 100 % 보장되지 않는다면 NPE 방어 로직을 추가해 주세요.

src/main/java/stackpot/stackpot/search/service/SearchServiceImpl.java (1)

58-61: 예외 무시는 위험합니다

catch (Exception ignored)로 모든 예외를 삼키면 인증 관련 진짜 오류까지 숨겨집니다.
AuthenticationException만 잡고, 그 외 예외는 로깅하거나 재전파하는 편이 안전합니다.

src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java (1)

193-195: 피드 정렬 기준이 없습니다

feedRepository.findByUser_Id(userId) 결과가 정의된 정렬이 없으면 UI 일관성이 깨질 수 있습니다.
OrderByCreatedAtDesc 등의 메서드 명세 또는 Sort 파라미터를 추가해 주세요.

src/main/java/stackpot/stackpot/user/controller/UserController.java (2)

405-426: size 파라미터 검증 추가 권장

현재 size에 상한이 없어 과도한 요청이 가능해집니다.
@Min(1) @Max(100) 등 Bean Validation을 적용해 방어해 주세요.


437-443: 동일한 검증 로직 반복

/feeds 엔드포인트도 위와 동일한 size 검증이 필요합니다.
공통 파라미터는 메서드 추출 또는 @Validated DTO로 재사용하면 중복을 줄일 수 있습니다.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 37df66a and 2326cb7.

📒 Files selected for processing (15)
  • src/main/java/stackpot/stackpot/feed/controller/FeedController.java (1 hunks)
  • src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java (4 hunks)
  • src/main/java/stackpot/stackpot/feed/service/FeedQueryService.java (1 hunks)
  • src/main/java/stackpot/stackpot/feed/service/FeedQueryServiceImpl.java (5 hunks)
  • src/main/java/stackpot/stackpot/pot/converter/PotApplicationConverter.java (1 hunks)
  • src/main/java/stackpot/stackpot/pot/converter/PotConverter.java (1 hunks)
  • src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (1 hunks)
  • src/main/java/stackpot/stackpot/save/repository/FeedSaveRepository.java (2 hunks)
  • src/main/java/stackpot/stackpot/search/service/SearchServiceImpl.java (2 hunks)
  • src/main/java/stackpot/stackpot/user/controller/UserController.java (4 hunks)
  • src/main/java/stackpot/stackpot/user/converter/UserMypageConverter.java (2 hunks)
  • src/main/java/stackpot/stackpot/user/dto/response/UserMyPageResponseDto.java (0 hunks)
  • src/main/java/stackpot/stackpot/user/entity/enums/Role.java (1 hunks)
  • src/main/java/stackpot/stackpot/user/service/UserCommandService.java (1 hunks)
  • src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java (1 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/stackpot/stackpot/user/dto/response/UserMyPageResponseDto.java
🔇 Additional comments (2)
src/main/java/stackpot/stackpot/user/entity/enums/Role.java (1)

11-11: 레거시 ‘씨앗’ 문자열 완전 제거 및 ‘새싹’ 사용 일관성 확인

  • rg 검색 결과 코드베이스에 “씨앗” 하드코딩이 전혀 남아있지 않습니다.
  • “ 새싹” 문자열 사용처도 아래와 같이 일관되게 적용되어 있습니다.
    • src/main/java/stackpot/stackpot/user/converter/UserConverter.java
    • src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java
    • src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java
    • src/main/java/stackpot/stackpot/pot/converter/PotApplicationConverter.java
    • src/main/java/stackpot/stackpot/pot/converter/PotConverter.java
    • src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java

안심하고 머지하세요!

src/main/java/stackpot/stackpot/save/repository/FeedSaveRepository.java (1)

32-38: 중복된 쿼리 메서드 제거 및 스타일 통일 필요

  • countSavesByFeedIds와 동일한 동작을 하는 countByFeedIdsRaw가 중복 정의되어 있습니다.
    하나만 남기거나, 한 메서드에서 다른 쿼리로 위임하도록 정리해주세요.
  • 루트에 pom.xml/build.gradle/gradle.properties 파일이 발견되지 않아 Java 버전(및 Text Block 사용 가능 여부)을 확인할 수 없습니다.
    프로젝트 빌드 설정을 재검토하여 """ 문법이 지원되지 않으면 기존 단일 라인 문자열로 변경해주세요.

위치:

  • src/main/java/.../FeedSaveRepository.java

추가 제안:

  • DTO 프로젝션(SELECT new your.package.CountById(fs.feed.feedId, COUNT(fs)))을 적용하면 반환 타입 안전성을 더욱 높일 수 있습니다.

import stackpot.stackpot.feed.entity.enums.Category;
import stackpot.stackpot.feed.service.FeedQueryService;
import stackpot.stackpot.feed.service.FeedCommandService;
import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

미사용 import 제거 권장

UserMyPageResponseDto를 본 컨트롤러에서 사용하지 않습니다. 코드 정리 및 정적 분석 경고 방지를 위해 import를 제거하세요.

-import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;

🏁 Script executed:

#!/bin/bash
# 해당 타입이 파일 내에서 사용되는지 재확인
rg -n --no-heading 'UserMyPageResponseDto' src/main/java/stackpot/stackpot/feed/controller/FeedController.java

Length of output: 179


미사용 import 제거 필요
다음 컨트롤러에서 UserMyPageResponseDto가 전혀 참조되지 않습니다. 코드 정리와 정적 분석 경고 방지를 위해 해당 import를 제거하세요.

• 위치: src/main/java/stackpot/stackpot/feed/controller/FeedController.java (19번 라인)

-import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;
🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/feed/controller/FeedController.java at line
19, the import statement for UserMyPageResponseDto is unused. Remove this import
line to clean up the code and prevent static analysis warnings.

.feedId(feed.getFeedId())
.writerId(feed.getUser().getId())
.writer(feed.getUser().getNickname() + " 씨앗")
.writer(feed.getUser().getNickname() + " 새싹")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

닉네임 접미사(" 새싹") 하드코딩 반복 → 상수/헬퍼로 일원화하고, 캐시와의 출력 일관성도 맞춰주세요

  • 변경 자체(씨앗→새싹)는 적절합니다. 다만 동일한 문자열 결합이 여러 군데 반복되어 유지보수와 국제화에 취약합니다.
  • 캐시 경로 불일치: toFeedDtoFromCache()는 캐시의 writer 그대로 쓰고(toFeedCacheDto는 현재 접미사를 붙이지 않음), DB→DTO 경로는 접미사를 붙여 반환합니다. 동일 피드라도 캐시 여부에 따라 writer 표기가 달라질 수 있습니다.

권장:

  • 접미사 로직을 private 헬퍼로 일원화하고, 캐시에도 동일 규칙을 반영하거나 읽기 시점에만 일관되게 붙이도록 하세요.

아래와 같이 변경 라인에서는 헬퍼를 호출하도록 제안합니다.

-                .writer(feed.getUser().getNickname() + " 새싹")
+                .writer(displayName(feed.getUser()))
-                .writer(feed.getUser().getNickname()+ " 새싹")
+                .writer(displayName(feed.getUser()))
-                .creatorNickname(feed.getUser().getNickname()+" 새싹")
+                .creatorNickname(displayName(feed.getUser()))
-                .writer(feed.getUser().getNickname()+" 새싹")
+                .writer(displayName(feed.getUser()))

헬퍼 메서드 예시(클래스 내부에 추가):

private String displayName(User user) {
    String nickname = (user != null && user.getNickname() != null) ? user.getNickname() : "익명";
    return nickname + " 새싹";
}

캐시 일관성 방안 중 하나:

  • toFeedCacheDto()에서도 writer를 displayName(user)로 저장하거나,
  • 캐시 읽기 경로(toFeedDtoFromCache)에서 접미사를 붙이도록 통일.

추가 점검(선택):

  • 레포 전역에 남아있는 "씨앗" 문자열을 일괄 점검해 드릴 수 있습니다.

Also applies to: 64-64, 94-94, 113-113


🏁 Script executed:

#!/bin/bash
# "씨앗" 잔존 문자열/리소스 점검
rg -n --hidden -S '씨앗' -g '!**/node_modules/**' -g '!**/build/**' -g '!**/dist/**'

Length of output: 107


캐시 변환 로직 및 모든 닉네임 접미사 사용 위치를 한 번에 확인하기 위해 아래 스크립트를 실행해주세요.


🏁 Script executed:

#!/bin/bash
set -e

# 1. 캐시 저장 시 DTO 생성 메서드 위치 확인
rg -n "toFeedCacheDto" -g '*.java'

# 2. 캐시 조회 후 DTO 변환 시 메서드 위치 확인
rg -n "toFeedDtoFromCache" -g '*.java'

# 3. writer()에 직접 접미사 하드코딩된 모든 위치 확인
rg -n "writer(feed.getUser().getNickname" -g '*.java'

# 4. creatorNickname()에 직접 접미사 하드코딩된 모든 위치 확인
rg -n "creatorNickname(feed.getUser().getNickname" -g '*.java'

Length of output: 949


아래 스크립트로 새싹 접미사 사용 위치와 캐시 변환 메서드 동작을 한 번에 조회해주세요.


🏁 Script executed:

#!/bin/bash
set -e

# 1. FeedConverter.java: 캐시 저장/조회 메서드 주변 코드 확인
rg -n -B2 -A2 "toFeedCacheDto" src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java
rg -n -B2 -A2 "toFeedDtoFromCache" src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java

# 2. 전체 Java 파일에서 "새싹" 접미사 하드코딩 위치 확인
rg -n -B2 -A2 "새싹" -g '*.java'

Length of output: 9001


닉네임 접미사(" 새싹") 중복 호출 → 헬퍼로 일원화 & 캐시 처리 일관화 필요

FeedConverter 내 4곳뿐 아니라 PotConverter, PotDetailConverter, PotApplicationConverter, UserConverter, UserCommandServiceImpl 등에도 동일 패턴이 반복되고, 캐시 변환 경로(toFeedCacheDto/toFeedDtoFromCache)에서는 접미사 처리/미처리가 달라 일관성이 깨질 위험이 있습니다.

  • 모든 접미사 처리 위치에서 공통 헬퍼 메서드 사용
    • src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java (36, 64, 94, 113)
    • src/main/java/stackpot/stackpot/pot/converter/PotDetailConverter.java (43)
    • src/main/java/stackpot/stackpot/pot/converter/PotConverter.java (75)
    • src/main/java/stackpot/stackpot/pot/converter/PotApplicationConverter.java (48)
    • src/main/java/stackpot/stackpot/user/converter/UserConverter.java (39, 64)
    • src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java (246)
  • 캐시 저장(toFeedCacheDto)에는 순수 닉네임(raw)만, 조회 변환(toFeedDtoFromCache)에는 헬퍼 호출로 접미사 붙이도록 통일하거나, 반대로 저장 시에도 헬퍼 적용
  • 헬퍼 예시
    public class DisplayNameUtil {
        public static String appendSeedSuffix(String nickname) {
            String name = (nickname != null && !nickname.isEmpty()) ? nickname : "익명";
            return name + " 새싹";
        }
        public static String displayName(User user) {
            return appendSeedSuffix(user != null ? user.getNickname() : null);
        }
    }
  • 적용 예: FeedConverter.java
    -                .writer(feed.getUser().getNickname() + " 새싹")
    +                .writer(DisplayNameUtil.displayName(feed.getUser()))
  • 캐시→DTO 변환(toFeedDtoFromCache)에도 동일 헬퍼 사용
    -                .writer(feed.getWriter())
    +                .writer(DisplayNameUtil.appendSeedSuffix(feed.getWriter()))
🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/feed/converter/FeedConverter.java around line
36 and other specified lines, the nickname suffix " 새싹" is appended directly in
multiple places causing duplication and inconsistency with cache conversion.
Refactor by creating a common helper method (e.g., in a DisplayNameUtil class)
that appends the suffix consistently. Replace all direct suffix concatenations
in FeedConverter and related converters/services with calls to this helper.
Ensure cache storage uses raw nicknames and suffix is appended only during DTO
conversion, or apply the helper uniformly during both caching and conversion for
consistency.


import stackpot.stackpot.feed.entity.Feed;
import stackpot.stackpot.feed.dto.FeedResponseDto;
import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

반환 타입 변경(UserMyPageResponseDto) OK. 호출부 영향 점검 + 코드 스타일(들여쓰기) 정리 권장

  • getFeedsByUserId/getFeeds의 반환 타입 변경은 현재 리팩터링 방향과 일치합니다. 다만 기존에 FeedPreviewList를 기대하던 호출부가 있다면 컴파일 타임에 깨질 수 있으니 점검이 필요합니다.
  • 스타일: Line 14 들여쓰기가 깨져 있습니다. 정렬해 주세요.

들여쓰기 보정(diff):

-UserMyPageResponseDto getFeeds(Long nextCursor, int pageSize);
+     UserMyPageResponseDto getFeeds(Long nextCursor, int pageSize);

또한, 신규 DTO로의 변경 과정에서 nextCursor가 응답에 포함되지 않는 구조라면, 프런트의 커서 기반 페이지네이션 요구사항과 괴리가 없는지 확인이 필요합니다.

Also applies to: 12-12, 14-14


🏁 Script executed:

#!/bin/bash
# 1) 이전 타입(FeedPreviewList) 기대 호출부 탐색
rg -n --no-heading -S 'getFeedsByUserId\\(|getFeeds\\(' -A 2 -B 2

# 2) nextCursor를 여전히 사용하는지 컨트롤러/서비스 레이어에서 확인
rg -n --no-heading -S 'nextCursor' -A 2 -B 2

Length of output: 24877


FeedQueryService 변경사항: 호출부 영향 없음 + 들여쓰기 정리 + 페이징 커서 확인

  • getFeedsByUserId/getFeeds 인터페이스 선언부를 참조하는 호출부가 없어 컴파일 문제는 없습니다.
  • 인터페이스 선언부(Line 12, 14)의 메서드 들여쓰기를 다른 메서드 선언과 동일하게 4칸 들여쓰기 해주세요.
  • UserMyPageResponseDto에 nextCursor 필드가 정의되어 프런트의 커서 기반 페이지네이션 요구사항을 충족하는지 확인이 필요합니다.

들여쓰기 보정(diff):

-UserMyPageResponseDto getFeedsByUserId(Long userId, Long nextCursor, int pageSize);
-UserMyPageResponseDto getFeeds(Long nextCursor, int pageSize);
+    UserMyPageResponseDto getFeedsByUserId(Long userId, Long nextCursor, int pageSize);
+    UserMyPageResponseDto getFeeds(Long nextCursor, int pageSize);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import stackpot.stackpot.user.dto.response.UserMyPageResponseDto;
public interface FeedQueryService {
// … other imports and methods …
UserMyPageResponseDto getFeedsByUserId(Long userId, Long nextCursor, int pageSize);
UserMyPageResponseDto getFeeds(Long nextCursor, int pageSize);
// … remaining methods …
}
🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/feed/service/FeedQueryService.java at line 5,
adjust the indentation of the method declarations getFeedsByUserId and getFeeds
at lines 12 and 14 to use 4 spaces, matching the indentation style of other
methods in the interface. Also, verify that the UserMyPageResponseDto class
includes a nextCursor field to support cursor-based pagination as required by
the frontend.

Comment on lines +114 to +120
Set<Long> likedFeedIds = (userId != null)
? new HashSet<>(feedLikeRepository.findFeedIdsByUserId(userId))
: Collections.emptySet();

Set<Long> savedFeedIds = (userId != null)
? new HashSet<>(feedSaveRepository.findFeedIdsByUserId(userId))
: Collections.emptySet();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

불필요한 대용량 조회

findFeedIdsByUserId(userId)는 사용자가 좋아요/저장한 모든 피드 ID를 한꺼번에 가져옵니다.
검색 결과(feedIds) 집합으로 범위를 제한하면 메모리·네트워크 비용을 크게 줄일 수 있습니다.

제안: findFeedIdsByUserIdAndFeedIds(userId, feedIds) 형태의 배치 쿼리 추가 후 사용.

🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/search/service/SearchServiceImpl.java around
lines 114 to 120, the current code fetches all liked and saved feed IDs for a
user without filtering by the relevant feedIds, causing unnecessary large data
retrieval. To fix this, add new repository methods like
findFeedIdsByUserIdAndFeedIds(userId, feedIds) that accept the userId and the
subset of feedIds to limit the query scope. Then replace the current calls with
these new batch queries passing the filtered feedIds to reduce memory and
network usage.

Comment on lines +18 to +20
UserMyPageResponseDto getMypages();

UserMyPageResponseDto getUserMypage(Long userId, String dataType);
UserMyPageResponseDto getUserMypage(Long userId);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

시그니처 단순화는 👍 / 메서드 네이밍 일관성(getMypages vs getUserMypage) 정리 권장

  • dataType 제거로 책임이 명확해졌습니다. 다만 메서드명이 복수/단수와 CamelCase가 섞여 가독성이 떨어집니다.
    • getMypages → getMyPage (단수, CamelCase)
    • getUserMypage → getUserMyPage (CamelCase)

변경 제안(인터페이스 측 라인에 한정된 diff):

-    UserMyPageResponseDto getMypages();
+    UserMyPageResponseDto getMyPage();

-    UserMyPageResponseDto getUserMypage(Long userId);
+    UserMyPageResponseDto getUserMyPage(Long userId);

호출/구현부 영향이 크므로 레포 전역 참조를 함께 업데이트해야 합니다.


🏁 Script executed:

#!/bin/bash
# 인터페이스 메서드 사용처 점검
rg -n --no-heading -S 'getMypages|getMyPage|getUserMypage|getUserMyPage' -A 2 -B 2

Length of output: 1812


메서드 네이밍 통일 및 구현부 반영 필요

인터페이스와 구현 클래스 모두 복수/단수 혼용·CamelCase 불일치를 해결하기 위해 아래와 같이 메서드명을 변경하고, 전역 참조를 함께 업데이트하세요.

대상 파일

  • src/main/java/stackpot/stackpot/user/service/UserCommandService.java
  • src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java

제안하는 Diff

--- a/src/main/java/stackpot/stackpot/user/service/UserCommandService.java
@@
-    UserMyPageResponseDto getMypages();
+    UserMyPageResponseDto getMyPage();

@@
-    UserMyPageResponseDto getUserMypage(Long userId);
+    UserMyPageResponseDto getUserMyPage(Long userId);
--- a/src/main/java/stackpot/stackpot/user/service/UserCommandServiceImpl.java
@@
-    @Override
-    public UserMyPageResponseDto getMypages() {
+    @Override
+    public UserMyPageResponseDto getMyPage() {
         User user = authService.getCurrentUser();
         return buildUserMyPageResponse(user);
     }

@@
-    @Override
-    public UserMyPageResponseDto getUserMypage(Long userId) {
+    @Override
+    public UserMyPageResponseDto getUserMyPage(Long userId) {
         return getMyPageByUser(userId);
     }

– IDE 리팩토링 혹은 rg/grep 검색을 통해 호출부(Controller, 테스트 등) 전역 참조를 모두 교체했는지 확인 바랍니다.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
UserMyPageResponseDto getMypages();
UserMyPageResponseDto getUserMypage(Long userId, String dataType);
UserMyPageResponseDto getUserMypage(Long userId);
UserMyPageResponseDto getMyPage();
UserMyPageResponseDto getUserMyPage(Long userId);
Suggested change
UserMyPageResponseDto getMypages();
UserMyPageResponseDto getUserMypage(Long userId, String dataType);
UserMyPageResponseDto getUserMypage(Long userId);
@Override
public UserMyPageResponseDto getMyPage() {
User user = authService.getCurrentUser();
return buildUserMyPageResponse(user);
}
@Override
public UserMyPageResponseDto getUserMyPage(Long userId) {
return getMyPageByUser(userId);
}
🤖 Prompt for AI Agents
In src/main/java/stackpot/stackpot/user/service/UserCommandService.java lines
18-20 and in UserCommandServiceImpl.java, the method names use inconsistent
pluralization and CamelCase styles. Rename the methods to have consistent
singular or plural forms and uniform CamelCase formatting as suggested, then
update all references to these methods throughout the codebase including
controllers and tests using IDE refactoring tools or global search and replace
commands to ensure consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants